#ifndef _TGSafeDelete_
#define _TGSafeDelete_

#ifndef MySafeDelete
#define MySafeDelete(x)     if(NULL != x){delete x; x = NULL;}
#endif
#ifndef MySafeDeleteMAB
#define MySafeDeleteMAB(x)  if(NULL != x){delete[] x; x = NULL;}
#endif
#ifndef MySafeRelease
#define MySafeRelease(x)    if(NULL != x){x->Release();x = NULL;}
#endif
#ifndef MySafeCloseHandle
#define MySafeCloseHandle(x) if(NULL != x){::CloseHandle(x); x = NULL;}
#endif
#ifndef MySafeCloseSocket
#define MySafeCloseSocket(x) if(NULL != x){shutdown(x,SD_BOTH);closesocket(x); x = NULL;}
#endif
#ifndef MySafeWSACloseEvent
#define MySafeWSACloseEvent(x) if(NULL != x){::WSACloseEvent(x); x = NULL;}
#endif
#ifndef MySafeFreeLib
#define MySafeFreeLib(x)     if( NULL != x ){::FreeLibrary(x); x = NULL;}
#endif

#endif
